﻿@using Mangix.Mapping.SysRole
@model IEnumerable<SysRoleMapping>
@{
    ViewBag.Title = "角色列表";
}
  
    <h1>@ViewBag.Title</h1>
    <hr />
    <div class="row">
        <div class="col-sm-12">
            @PermissionRouteLinkIcon("添加角色", "editRole", null, new { @class = "btn btn-sm btn-pink " }, new { @class = "glyphicon glyphicon-plus" })
        </div>
    </div>
    <div class="space-2"></div>
    @if (Model != null)
    {
        <div class="row">
            <div class="col-sm-12">
                <table id="user_datatable" class="table table-striped table-bordered table-hover dataTable no-footer">
                    <thead>
                        <tr>
                            <th width="300px">名称</th>
                            <th width="200px">录入人员</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model)
                        {
                            <tr>
                                <td>@item.Name</td>
                                <td>@item.SysUserName</td>
                                <td>
                                    @PermissionRouteLinkIcon("", "editRole", new RouteValueDictionary(new { id = item.Id }), new { @class = "btn btn-xs btn-info", title = "修改" }, new { @class = "glyphicon glyphicon-pencil" })
                                    @PermissionRouteLinkIcon("", "deleteRole", new RouteValueDictionary(new { id = item.Id }), new { @class = "btn btn-xs btn-danger btnDelete", title = "删除" }, new { @class = "glyphicon glyphicon-trash" })
                                    @PermissionRouteLinkIcon("权限", "rolePermission", new RouteValueDictionary(new { id = item.Id }), new { @class = "btn btn-xs btn-purple", title = "设置权限" }, new { @class = "fa fa-bolt" })

                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
        </div>
        <script>
            $(function () {

                $(".btnDelete").click(function (e) {
                    e.preventDefault();
                    var url = $(this).attr('href');
                    $.modal.confirm('删除后将不可恢复，您确定要删除此角色？', function () {
                        $.get(url, function (data) {
                            $.modal.alert(data);
                        });
                    });
                });
            });
        </script>
    } 